package org.jwxa.jwxa4j.parser;

import java.util.ArrayList;
import java.util.List;

public abstract class TreeParserable {

	protected BuilderConfig config;
	protected List<TreeFilter> filters = new ArrayList<TreeFilter>();; 
	
	protected TreeParserable(BuilderConfig config) {
		this(config, null);
	}
	
	protected TreeParserable(BuilderConfig config, TreeFilter[] filterArray) {
		this.config = config;
		
		// 添加默认过滤器
		this.filters.add(new DefaultTagFilter());
		// 添加过滤器
		if( filterArray != null ) {
			for(TreeFilter filter: filterArray) {
				this.filters.add(filter);
			}
		}
	}
	
	public TreeParserable addFilter(TreeFilter filter) {
		this.filters.add(filter);
		return this;
	}
	
}
